package Chapter3;
import Chapter2.Node;
public class MyQueue {
	Node first, last;
	
	public void enqueue(int item)
	{
		Node newNode = new Node(item);
		if(first == null)
		{
			first = newNode;
			last = newNode;
		}else{
			last.Next = newNode;
			last = newNode;
		}
	}
	
	public Node dequeue()
	{
		if(first == null || last == null)
			return null;
		
		Node result = first;
		first = first.Next;
		return result;
	}
}
